<template>
	<view class="uni-tab-bar">
		<scroll-view scroll-x class="uni-swiper-tab">
			<block v-for="(tab,index) in tarbars" :key="tab.id">
				<view class="swiper-tab-list" :class="{'active':(tabIndex==index)}" @click="tabClick(index)">
					{{tab.name}}
					<view class="swiper-tab-line"></view>
				</view>
			</block>
		</scroll-view>
	</view>
</template>

<script>
	export default {
		props: {
			tarbars:Array,
			tabIndex: Number
		},
		methods: {
			tabClick(index) {
				this.$emit('tabClickTap',index)
			}
		}
	}
</script>

<style lang="scss">
	.uni-tab-bar {
		.uni-swiper-tab {
			border-bottom: 1rpx solid #EEEEEE; //画线条

			.swiper-tab-list {
				color: #949494;
				font-weight: bold;
			}

			.active {
				color: #343434;

				.swiper-tab-line {
					border-bottom: 6rpx solid #FFB400;
					width: 70rpx;
					margin: auto;
					border-top: 6rpx solid #FFB400;
					border-radius: 20rpx;
				}
			}
		}

	}
</style>
